// 路由配置

import Login from '@/pages/Login/LoginPage';
import AuthLayout from '@/components/AuthLayout';
import Register from '@/pages/Register/RegisterPage';

import Dashboard from '@/pages/Dash/DashboardNav';
import Tutorial from '@/pages/Tutorial/TutorialNav';
import Users from '@/pages/Users/UsersNav';
import Roles from '@/pages/Roles/RolesNav';
import Menus from '@/pages/Menus/MenuNav';
import Error from '@/pages/Error/ErrorNav';
import RoleAllo from '@/pages/Roles/RoleAlloRole';

import { createBrowserRouter } from 'react-router-dom';
import RoleAlloRes from '../pages/Roles/RoleAlloRes';
import RoleAdd from '../pages/Roles/RoleAdd';
import UserAdd from '../pages/Users/UserAdd';
import UserEdit from '../pages/Users/UserEdit';

// 配置路由实例
const router = createBrowserRouter([
    {
        path: "/login",
        element: <Login />
    },
    {
        path: "/",
        element: <AuthLayout/ >,
        children: [
            {
                path: 'dashboard',
                element: <Dashboard />
            },
            {
                path: 'tutorial',
                element: <Tutorial />
            },
            {
                path: 'users',
                element: <Users />
            },
            {
                path: 'user/add',
                element: <UserAdd />
            },
            {
                path: 'user/edit/:id',
                element: <UserEdit />
            },
            {
                path: 'roles',
                element: <Roles />
            },
            {
                path: 'role/add',
                element: <RoleAdd />
            },
            {
                path: 'menus',
                element: <Menus />
            },
            {
                path: 'roleAllo/:id',
                element: <RoleAllo />
            },
            {
                path: 'resourceAllo/:id',
                element: <RoleAlloRes />
            },
            {
                path: '*',
                element: <Error />
            }
        ]
    },
    {
        path: "/register",
        element: <Register />
    }
]);

export default router;
